import { User } from "../../entity/User";
import { userService } from "../userService";
import { Service,Inject } from "typedi";
import { UserDao } from "../../dao/UserDao";
import  {res}  from "../../utils/jsonResult";
import { addUser } from "@/m_req/User";
import { User as UserType} from "@/m_res/user";

@Service()
export class UserServiceimpl implements userService{

    @Inject()
    UserDao!:UserDao;
    
    GetAlluser(): User[] {
        throw new Error("Method not implemented.");
    }
    async GetOneuser(id:number): Promise<res<User | null>> {
        console.log("cccccc",id)
        return await this.UserDao.GetOneuser(id)
    }
   //用户添加
    async addUser(params: addUser): Promise<res<null>> {
        
        return await this.UserDao.addUserDao(params);
    }

    //登录查询
    async Login(params: addUser): Promise<res<UserType | null>> {
        return await this.UserDao.LoginDao(params);
    }
    //token查询
    async GetOneUser(id: number): Promise<res<UserType | null>> {
        return await this.UserDao.GetOneUser(id);
    }

}